submitHomeWork = function(){
	Ext.define('fileModel',{
		extend:'Ext.data.Model',
		fields:[ 
		        	{name:'fileId',type:'String'},
		        	{name:'studentId',type:'String'},
		        	{name:'teacherId',type:'string'},
		        	{name:'fileName',type:'string'},
		        	{name:'filePath',type:'String'},
			        {name:'uploadTime',type:'string'}
			      
			       ],
		idProperty : 'fileId'
	});
	

	var store = Ext.create('Ext.data.Store',{
		pageSize:100,
		model:fileModel,
		autoLoad:true,
		proxy:{
			type:'ajax',
			url:'queryHomeWorkFileAction.action',
			reader:{
				type:'json',
				root:'resultList.list',
				totalProperty:'resultList.total'
			}
		}
	});
	
	var checkBox = Ext.create('Ext.selection.CheckboxModel');
	var grid = Ext.create('Ext.grid.Panel',{
		store:store,	
		columnLines:true,
		selModel:checkBox,
		disableSelection:false,
		//width:600,
		id:"grid11",
		loadMask:true,
		columns:[
		         {text:'学号',width:100,dataIndex:'studentId',sortable:true,editor:{allowBlank : false}},
		         {text:'文件名称',width:500,dataIndex:'fileName',sortable:true,editor:{allowBlank : false}},
		         {text:'提交日期',width:100,dataIndex:'uploadTime',sortable:true,
		        	 renderer:function(v){
		        		 return v.replace("T"," ").substring(0,16);
		        		 }},
		         ],
		autoHeight:true,
		authWidth:true,

		title:"作业列表",
		loadMask:true,
		pageSize:5,
		dockedItems:[{
			dock:'top',
			xtype:'toolbar',
			//height:200,
			items:[/*{
				width:300,
				fieldLabel:'搜索',
				labelWidth:70,
				xtype:'searchfield',
				store:store			
			},*//*{
				xtype:'label',
				html:'<div style="font-size:12px;color:red">*支持学号的模糊查询</div>'
			},*/{
					text:'上传作业',
					iconCls:'Add',
					xtype:'button',
					handler:function(){
						uploadWin();
					}
			}]		
		},
		{
			dock:'bottom',
			xtype:'pagingtoolbar',	
			store:store,
			displayInfo:true,
			displayMsg:'显示{0}-{1}条，共计{2}条',
			emptyMsg:"没有数据"
		}/*,{
			dock:'bottom',
			xtype:'label',
			html:'<div style="font-size:12px;color:red">1.双击进行单行编辑&nbsp&nbsp2.编辑或新增后需要提交数据进行保存&nbsp&nbsp3.登录账号不能重复，输入后会验证</div>'
		}*/
		]
	});
	
	var uploadForm=new Ext.FormPanel({ 
		//title:'上传作业文件',
	    id:'uploadForm', 
	    anchor:'100%',	    
	    frame:true, 
	    fileUpload: true,   
	    autoHeight:true, 
	    labelWidth:50, 
	    enctype: 'multipart/form-data',  
	    defaults:{ 
	        anchor: '55%', 
	        allowBlank: false 
	    }, 
	    items:[ 
	        { 
	            xtype:'fileuploadfield', 
	            emptyText: '请选择上传文件...',  
	            fieldLabel: '文件', 
	            labelWidth:40,
	            id:'uploadFile', 
	            name: 'upload',  
	            allowBlank: false,    
	            blankText: '文件名称不能为空.',    
	            buttonConfig: { 
	                        text: '选择...'
	              } 
	        } 
	    ], 
	    buttons: [{ 
	                    text: '上传', 
	                    handler: function(){ 
	                    	if(TEACHER_ID == ''  || TEACHER_ID == 'null'){
	                    		Ext.MessageBox.alert('警告', '你暂时还没有分配导师，不能上传作业！'); 
	                    		return ;
	                    	}
	                        if(uploadForm.getForm().isValid()){ 
	                            uploadForm.getForm().submit({ 
	                                url:'uploadHomeWorkFileAction.action', 
	                                method:'POST', 
	                                waitTitle: '请稍后', 
	                                waitMsg: '正在上传文档文件 ...', 
	                                success: function(fp, action){ 
	                                    Ext.MessageBox.alert('信息', "上传成功");   
	                                    Ext.getCmp("uploadFile").reset();          // 指定文件字段的id清空其内容  
	                                    Ext.getCmp('uploadWin').close();
	                                    store.load(); 
	                                    
	                                }, 
	                                failure: function(fp, action){ 
	                                    Ext.MessageBox.alert('警告', action.result.msg);   
	                                } 
	                            }); 
	                        } 
	                    }
	                },{ 
	                    text: '重置', 
	                    handler: function(){ 
	                        uploadForm.getForm().reset(); 
	                    } 
	                }],
	    buttonAlign:'center'    
	});
	
	function uploadWin(){
		var uploadForm=new Ext.FormPanel({ 
			//title:'上传作业文件',
		    id:'uploadForm', 
		    anchor:'100%',	    
		    frame:true, 
		    fileUpload: true,   
		    autoHeight:true, 
		    labelWidth:50, 
		    enctype: 'multipart/form-data',  
		    defaults:{ 
		        anchor: '55%', 
		        allowBlank: false 
		    }, 
		    items:[ 
		        { 
		            xtype:'fileuploadfield', 
		            emptyText: '请选择上传文件...',  
		            fieldLabel: '文件', 
		            labelWidth:40,
		            id:'uploadFile', 
		            name: 'upload',  
		            allowBlank: false,    
		            blankText: '文件名称不能为空.',    
		            buttonConfig: { 
		                        text: '选择...'
		              } 
		        } 
		    ], 
		    buttons: [{ 
		                    text: '上传', 
		                    handler: function(){ 
		                    	if(TEACHER_ID == ''  || TEACHER_ID == 'null'){
		                    		Ext.MessageBox.alert('警告', '你暂时还没有分配导师，不能上传作业！'); 
		                    		return ;
		                    	}
		                        if(uploadForm.getForm().isValid()){ 
		                            uploadForm.getForm().submit({ 
		                                url:'uploadHomeWorkFileAction.action', 
		                                method:'POST', 
		                                waitTitle: '请稍后', 
		                                waitMsg: '正在上传文档文件 ...', 
		                                success: function(fp, action){ 
		                                    Ext.MessageBox.alert('信息', "上传成功");   
		                                    Ext.getCmp("uploadFile").reset();          // 指定文件字段的id清空其内容  
		                                    Ext.getCmp('uploadWin').close();
		                                    store.load(); 
		                                    
		                                }, 
		                                failure: function(fp, action){ 
		                                    Ext.MessageBox.alert('警告', action.result.msg);   
		                                } 
		                            }); 
		                        } 
		                    }
		                },{ 
		                    text: '重置', 
		                    handler: function(){ 
		                        uploadForm.getForm().reset(); 
		                    } 
		                }],
		    buttonAlign:'center'    
		});
		var win = Ext.create("Ext.window.Window", {
	        title: "上传作业文件",       //标题
	        draggable: false,
	       // icon: '../../../Images/extjs/pencil.png',
	       // height: 600,                          //高度
	       // width: 800,                           //宽度
	        layout: "fit",                        //窗口布局类型
	        modal: true, //是否模态窗口，默认为false
	        resizable: false,
	        id:'uploadWin',
	        items: [uploadForm]
	    });
		win.show();
	}
	return grid;
}